<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if ( ! function_exists('get_domain')) 
{
	/**
	 * get_domain
	 * 
	 * Gets domain of site based on specified 'base_url' in config file
	 * 
	 * @access public
	 * @param void
	 * @return string
	 */
	function get_domain() 
	{
		$CI =& get_instance();
    	return preg_replace("/^[\w]{2,6}:\/\/([\w\d\.\-]+).*$/","$1", $CI->config->slash_item('base_url'));
	}
	
	/**
	 * to_url
	 * 
	 * Convert path to proper url
	 * 
	 * @access public
	 * @param string
	 * @return string
	 */
	function to_url($path)
	{
		$CI =& get_instance();
		
		if (strpos($path, BASEPATH) !== FALSE)
		{
			$path = str_replace(BASEPATH, NULL, $path);
		}
		
		if (strpos($path, FCPATH) !== FALSE)
		{
			$path = str_replace(FCPATH, NULL, $path);
		}
		
		if (strpos($path, APPPATH) !== FALSE)
		{
			$path = str_replace(APPPATH, NULL, $path);
		}
		
		return base_url() . $path;
	}
}
/* End of file MY_url_helper.php */
/* Location: ./application/helpers/MY_url_helper.php */
